//
//  DestinationModel.m
//  NBTripe
//
//  Created by 陈曦 on 16/1/7.
//  Copyright © 2016年 Vicki. All rights reserved.
//

#import "DestinationModel.h"

@implementation DestinationModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"search_data"]) {
        NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in value) {
            VCsearchButtonModel *searchModel = [[VCsearchButtonModel alloc] initWithDataSource:dic];
            [mutableArray addObject:searchModel];
        }
        self.searchArray = [NSArray arrayWithArray:mutableArray];
        
    }
    if ([key isEqualToString:@"banners"]) {
        NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in value) {
            VCbannerModel *bannerModel = [[VCbannerModel alloc] initWithDataSource:dic];
            [mutableArray addObject:bannerModel];

        }
        self.bannerArray = [NSArray arrayWithArray:mutableArray];

    }
    
    if ([key isEqualToString:@"elements"]) {
        NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in value) {
            VCelementModel *elementModel = [[VCelementModel alloc] initWithDataSource:dic];
            [mutableArray addObject:elementModel];

        }
        self.elementArray = [NSArray arrayWithArray:mutableArray];

    }
}

@end
